/********************************************************************************
 *      Copyright:  (C) 2025 chenhongyu IOT STUDY
 *                  All rights reserved.
 *
 *       Filename:  main.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(22/07/25)
 *         Author:  chenhongyu <chenhongyu0822@163.com>
 *      ChangeLog:  1, Release initial version on "22/07/25 21:59:55"
 *                 
 ********************************************************************************/
#ifndef    MAIN_H
#define    MAIN_H

#include <stdint.h>
#include <dbus/dbus.h>
#include <mosquitto.h>

typedef struct{
	DBusConnection     *conn;
	const char         *notify_char_path;
	const char         *cmd_char_path;
	volatile int       has_cmd;
	char               cmd_buf[256];
	uint8_t            recv_buf[256];
	int                recv_len;
}ble_ctx;

typedef struct{
	struct mosquitto   *mosq;
	const char         *host;
	int                 port;
	const char         *client_id;
	const char         *username;
	const char         *password;
	const char         *topic_cmd;
	const char         *topic_data;
}mqtt_ctx;

typedef struct{
	ble_ctx            ble;
	mqtt_ctx           mqtt;
}bled_t;

#endif
